﻿using DFGK_WMS.Model.DTO;
using DFGK_WMS.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK_WMS.IRepository
{
    public interface ITTransferBinOrderRepository: IBaseRepository<TTransferBinOrder>
    {
        /// <summary>
        /// 提交数据 （增加/修改/删除）
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        bool SubmitTransferBinOrderData(TTransferBinOrderDTO obj);
        /// <summary>
        /// 查询所有移库单
        /// </summary>
        /// <param name="AsNoTracking">关键字</param>
        /// <param name="kid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<TTransferBinOrder> GetTransferBinOrderList(string AsNoTracking, string? StartTime, string? EndTime,string ? CellName, int pageIndex, int pageSize, out int totalCount);


        List<TTransferBinOrderDTO> GetTransferBinList(string AsNoTracking, string? StartTime, string? EndTime, string? CellName, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 删除移库单
        /// </summary>
        /// <param name="tid"></param>
        /// <returns></returns>
        bool DelTransferBinOrder(int tid);
        /// <summary>
        /// 修改移库单信息
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        bool UpdateTransferBinOrder(TTransferBinOrder t);
        /// <summary>
        /// 根据id获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TTransferBinOrder GetTransferBinOrderById(int id);

        /// <summary>
        /// 获取移库的可用空仓位
        /// </summary>
        /// <param name="fromLocationId"></param>
        /// <param name="isPriorityFilling"></param>
        /// <param name="filterType"></param>
        /// <param name="toLogicalPartCode"></param>
        /// <returns></returns>
        List<TCell> GetEnabledCellListByFromLocationId(string? toLogicalPartCode,int FromLocationId, bool isPriorityFilling = false, int filterType = 1);

        /// <summary>
        /// 查看移库单的详细信息
        /// </summary>
        /// <param name="Id">移库单id</param>
        /// <returns></returns>
        TTransferBinOrderDTO SelectTransferBinOrder(int Id);

        bool SubmitTranState(SubmitTranDTO submitTranDTO);

        /// <summary>
        /// 添加数据到sqlite
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool AddSqliteDetail(TTransferBinOrderDTO m, out string message);


        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool UpdTTransferBinDetailDtoStatus(TTransferBinDetailDto m, out string message);

        /// <summary>
        /// 根据OrderSn获取数据
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <returns></returns>
        List<TTransferBinOrderDTO> GetTTransferBinByOrderSn(string OrderSn);


        /// <summary>
        /// 读取sqlite数据库数据
        /// </summary>
        /// <returns></returns>
        bool SubmitTransferBin(out string message);


        /// <summary>
        /// 获取单号状态为2的单号
        /// </summary>
        /// <returns></returns>
        List<string> GetTransferBinOrderSn();

        /// <summary>
        /// 根据单号获取详情
        /// </summary>
        /// <param name="orderSn"></param>
        /// <returns></returns>
        List<TTransferBinOrderDetail> GetTransferBinOrderDetailsByOrderSn(string orderSn);


        /// <summary>
        /// 提交（有网）
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool UpTransferBinOrderStatus(TTransferBinOrderDetail m,out string message);
    }
}
